#include "StaticFFT_5.h"
#include "FFTCommon.h"
#include <xmmintrin.h>
#ifdef __AVX__
#include <immintrin.h>
#endif

#ifndef __AVX__
//SSE
void StaticFFT_5()
{
	float Re0, Re1, Re2, Re3;
	float Im0, Im1, Im2, Im3;
	float RA, IA;
	float RF1, IF1, RF2, IF2;
	float R, I;
	__m128 mRF1, mIF1, mRF2, mIF2;
	__m128 mR, mI;
	R = SFRe[30] + SFRe[31];
	I = SFIm[30] + SFIm[31];
	SFRe[31] = SFRe[30] - SFRe[31];
	SFIm[31] = SFIm[30] - SFIm[31];
	SFRe[30] = R;
	SFIm[30] = I;
	R = SFRe[28] + SFRe[29];
    I = SFIm[28] + SFIm[29];
	SFRe[29] = SFRe[28] - SFRe[29];
	SFIm[29] = SFIm[28] - SFIm[29];
	SFRe[28] = R;
	SFIm[28] = I;
	Re0 = SFRe[24]; Im0 = SFIm[24];
	Re1 = SFRe[25]; Im1 = SFIm[25];
	Re2 = SFRe[26]; Im2 = SFIm[26];
	Re3 = SFRe[27]; Im3 = SFIm[27];
	SFRe[24] = Re0 + Re1; SFIm[24] = Im0 + Im1;
	SFRe[25] = Re0 - Re1; SFIm[25] = Im0 - Im1;
	SFRe[26] = Re2 + Re3; SFIm[26] = Im2 + Im3;
	SFRe[27] = Im2 - Im3; SFIm[27] = Re3 - Re2;
	RA = SFRe[24] + SFRe[26];
	IA = SFIm[24] + SFIm[26];
	SFRe[26] = SFRe[24] - SFRe[26];
	SFIm[26] = SFIm[24] - SFIm[26];
	SFRe[24] = RA;
	SFIm[24] = IA;
	RA = SFRe[25] + SFRe[27];
	IA = SFIm[25] + SFIm[27];
	SFRe[27] = SFRe[25] - SFRe[27];
	SFIm[27] = SFIm[25] - SFIm[27];
	SFRe[25] = RA;
	SFIm[25] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[28];
	I = SFIm[28];
	SFRe[28] = R * RF1 - I * IF1;
	SFIm[28] = R * IF1 + I * RF1;
	R = SFRe[30];
	I = SFIm[30];
	SFRe[30] = R * RF2 - I * IF2;
	SFIm[30] = R * IF2 + I * RF2;
	R = SFRe[30];
	I = SFIm[30];
	SFRe[30] = SFIm[28] - I;
	SFIm[30] = R - SFRe[28];
	SFRe[28] += R;
	SFIm[28] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[29];
	I = SFIm[29];
	SFRe[29] = R * RF1 - I * IF1;
	SFIm[29] = R * IF1 + I * RF1;
	R = SFRe[31];
	I = SFIm[31];
	SFRe[31] = R * RF2 - I * IF2;
	SFIm[31] = R * IF2 + I * RF2;
	R = SFRe[31];
	I = SFIm[31];
	SFRe[31] = SFIm[29] - I;
	SFIm[31] = R - SFRe[29];
	SFRe[29] += R;
	SFIm[29] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 24), _mm_load_ps(SFRe + 28));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 24), _mm_load_ps(SFIm + 28));
	_mm_store_ps(SFRe + 28, _mm_sub_ps(_mm_load_ps(SFRe + 24), _mm_load_ps(SFRe + 28)));
	_mm_store_ps(SFIm + 28, _mm_sub_ps(_mm_load_ps(SFIm + 24), _mm_load_ps(SFIm + 28)));
	_mm_store_ps(SFRe + 24, mR);
	_mm_store_ps(SFIm + 24, mI);
	R = SFRe[22] + SFRe[23];
	I = SFIm[22] + SFIm[23];
	SFRe[23] = SFRe[22] - SFRe[23];
	SFIm[23] = SFIm[22] - SFIm[23];
	SFRe[22] = R;
	SFIm[22] = I;
	R = SFRe[20] + SFRe[21];
	I = SFIm[20] + SFIm[21];
	SFRe[21] = SFRe[20] - SFRe[21];
	SFIm[21] = SFIm[20] - SFIm[21];
	SFRe[20] = R;
	SFIm[20] = I;
	Re0 = SFRe[16]; Im0 = SFIm[16];
	Re1 = SFRe[17]; Im1 = SFIm[17];
	Re2 = SFRe[18]; Im2 = SFIm[18];
	Re3 = SFRe[19]; Im3 = SFIm[19];
	SFRe[16] = Re0 + Re1; SFIm[16] = Im0 + Im1;
	SFRe[17] = Re0 - Re1; SFIm[17] = Im0 - Im1;
	SFRe[18] = Re2 + Re3; SFIm[18] = Im2 + Im3;
	SFRe[19] = Im2 - Im3; SFIm[19] = Re3 - Re2;
	RA = SFRe[16] + SFRe[18];
	IA = SFIm[16] + SFIm[18];
	SFRe[18] = SFRe[16] - SFRe[18];
	SFIm[18] = SFIm[16] - SFIm[18];
	SFRe[16] = RA;
	SFIm[16] = IA;
	RA = SFRe[17] + SFRe[19];
	IA = SFIm[17] + SFIm[19];
	SFRe[19] = SFRe[17] - SFRe[19];
	SFIm[19] = SFIm[17] - SFIm[19];
	SFRe[17] = RA;
	SFIm[17] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[20];
	I = SFIm[20];
	SFRe[20] = R * RF1 - I * IF1;
	SFIm[20] = R * IF1 + I * RF1;
	R = SFRe[22];
	I = SFIm[22];
	SFRe[22] = R * RF2 - I * IF2;
	SFIm[22] = R * IF2 + I * RF2;
	R = SFRe[22];
	I = SFIm[22];
	SFRe[22] = SFIm[20] - I;
	SFIm[22] = R - SFRe[20];
	SFRe[20] += R;
	SFIm[20] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[21];
	I = SFIm[21];
	SFRe[21] = R * RF1 - I * IF1;
	SFIm[21] = R * IF1 + I * RF1;
	R = SFRe[23];
	I = SFIm[23];
	SFRe[23] = R * RF2 - I * IF2;
	SFIm[23] = R * IF2 + I * RF2;
	R = SFRe[23];
	I = SFIm[23];
	SFRe[23] = SFIm[21] - I;
	SFIm[23] = R - SFRe[21];
	SFRe[21] += R;
	SFIm[21] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 16), _mm_load_ps(SFRe + 20));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 16), _mm_load_ps(SFIm + 20));
	_mm_store_ps(SFRe + 20, _mm_sub_ps(_mm_load_ps(SFRe + 16), _mm_load_ps(SFRe + 20)));
	_mm_store_ps(SFIm + 20, _mm_sub_ps(_mm_load_ps(SFIm + 16), _mm_load_ps(SFIm + 20)));
	_mm_store_ps(SFRe + 16, mR);
	_mm_store_ps(SFIm + 16, mI);
	Re0 = SFRe[12]; Im0 = SFIm[12];
	Re1 = SFRe[13]; Im1 = SFIm[13];
	Re2 = SFRe[14]; Im2 = SFIm[14];
	Re3 = SFRe[15]; Im3 = SFIm[15];
	SFRe[12] = Re0 + Re1; SFIm[12] = Im0 + Im1;
	SFRe[13] = Re0 - Re1; SFIm[13] = Im0 - Im1;
	SFRe[14] = Re2 + Re3; SFIm[14] = Im2 + Im3;
	SFRe[15] = Im2 - Im3; SFIm[15] = Re3 - Re2;
	RA = SFRe[12] + SFRe[14];
	IA = SFIm[12] + SFIm[14];
	SFRe[14] = SFRe[12] - SFRe[14];
	SFIm[14] = SFIm[12] - SFIm[14];
	SFRe[12] = RA;
	SFIm[12] = IA;
	RA = SFRe[13] + SFRe[15];
	IA = SFIm[13] + SFIm[15];
	SFRe[15] = SFRe[13] - SFRe[15];
	SFIm[15] = SFIm[13] - SFIm[15];
	SFRe[13] = RA;
	SFIm[13] = IA;
	Re0 = SFRe[8]; Im0 = SFIm[8];
	Re1 = SFRe[9]; Im1 = SFIm[9];
	Re2 = SFRe[10]; Im2 = SFIm[10];
	Re3 = SFRe[11]; Im3 = SFIm[11];
	SFRe[8] = Re0 + Re1; SFIm[8] = Im0 + Im1;
	SFRe[9] = Re0 - Re1; SFIm[9] = Im0 - Im1;
	SFRe[10] = Re2 + Re3; SFIm[10] = Im2 + Im3;
	SFRe[11] = Im2 - Im3; SFIm[11] = Re3 - Re2;
	RA = SFRe[8] + SFRe[10];
	IA = SFIm[8] + SFIm[10];
	SFRe[10] = SFRe[8] - SFRe[10];
	SFIm[10] = SFIm[8] - SFIm[10];
	SFRe[8] = RA;
	SFIm[8] = IA;
	RA = SFRe[9] + SFRe[11];
	IA = SFIm[9] + SFIm[11];
	SFRe[11] = SFRe[9] - SFRe[11];
	SFIm[11] = SFIm[9] - SFIm[11];
	SFRe[9] = RA;
	SFIm[9] = IA;
	R = SFRe[6] + SFRe[7];
	I = SFIm[6] + SFIm[7];
	SFRe[7] = SFRe[6] - SFRe[7];
	SFIm[7] = SFIm[6] - SFIm[7];
	SFRe[6] = R;
	SFIm[6] = I;
	R = SFRe[4] + SFRe[5];
	I = SFIm[4] + SFIm[5];
	SFRe[5] = SFRe[4] - SFRe[5];
	SFIm[5] = SFIm[4] - SFIm[5];
	SFRe[4] = R;
	SFIm[4] = I;
	Re0 = SFRe[0]; Im0 = SFIm[0];
	Re1 = SFRe[1]; Im1 = SFIm[1];
	Re2 = SFRe[2]; Im2 = SFIm[2];
	Re3 = SFRe[3]; Im3 = SFIm[3];
	SFRe[0] = Re0 + Re1; SFIm[0] = Im0 + Im1;
	SFRe[1] = Re0 - Re1; SFIm[1] = Im0 - Im1;
	SFRe[2] = Re2 + Re3; SFIm[2] = Im2 + Im3;
	SFRe[3] = Im2 - Im3; SFIm[3] = Re3 - Re2;
	RA = SFRe[0] + SFRe[2];
	IA = SFIm[0] + SFIm[2];
	SFRe[2] = SFRe[0] - SFRe[2];
	SFIm[2] = SFIm[0] - SFIm[2];
	SFRe[0] = RA;
	SFIm[0] = IA;
	RA = SFRe[1] + SFRe[3];
	IA = SFIm[1] + SFIm[3];
	SFRe[3] = SFRe[1] - SFRe[3];
	SFIm[3] = SFIm[1] - SFIm[3];
	SFRe[1] = RA;
	SFIm[1] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[4];
	I = SFIm[4];
	SFRe[4] = R * RF1 - I * IF1;
	SFIm[4] = R * IF1 + I * RF1;
	R = SFRe[6];
	I = SFIm[6];
	SFRe[6] = R * RF2 - I * IF2;
	SFIm[6] = R * IF2 + I * RF2;
	R = SFRe[6];
	I = SFIm[6];
	SFRe[6] = SFIm[4] - I;
	SFIm[6] = R - SFRe[4];
	SFRe[4] += R;
	SFIm[4] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[5];
	I = SFIm[5];
	SFRe[5] = R * RF1 - I * IF1;
	SFIm[5] = R * IF1 + I * RF1;
	R = SFRe[7];
	I = SFIm[7];
	SFRe[7] = R * RF2 - I * IF2;
	SFIm[7] = R * IF2 + I * RF2;
	R = SFRe[7];
	I = SFIm[7];
	SFRe[7] = SFIm[5] - I;
	SFIm[7] = R - SFRe[5];
	SFRe[5] += R;
	SFIm[5] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 4));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 4));
	_mm_store_ps(SFRe + 4, _mm_sub_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 4)));
	_mm_store_ps(SFIm + 4, _mm_sub_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 4)));
	_mm_store_ps(SFRe + 0, mR);
	_mm_store_ps(SFIm + 0, mI);
	mRF1 = _mm_set_ps(0.382712, 0.707133, 0.923896, 1.000000);
	mIF1 = _mm_set_ps(-0.923868, -0.707080, -0.382643, -0.000000);
	mRF2 = _mm_set_ps(-0.923896, -0.707098, 0.382712, 1.000000);
	mIF2 = _mm_set_ps(0.382643, -0.707116, -0.923868, -0.000000);
	mR = _mm_load_ps(SFRe + 8);
	mI = _mm_load_ps(SFIm + 8);
	_mm_store_ps(SFRe + 8, _mm_sub_ps(_mm_mul_ps(mR, mRF1), _mm_mul_ps(mI, mIF1)));
	_mm_store_ps(SFIm + 8, _mm_add_ps(_mm_mul_ps(mR, mIF1), _mm_mul_ps(mI, mRF1)));
	mR = _mm_load_ps(SFRe + 12);
	mI = _mm_load_ps(SFIm + 12);
	_mm_store_ps(SFRe + 12, _mm_sub_ps(_mm_mul_ps(mR, mRF2), _mm_mul_ps(mI, mIF2)));
	_mm_store_ps(SFIm + 12, _mm_add_ps(_mm_mul_ps(mR, mIF2), _mm_mul_ps(mI, mRF2)));
	mR = _mm_load_ps(SFRe + 12);
	mI = _mm_load_ps(SFIm + 12);
	_mm_store_ps(SFRe + 12, _mm_sub_ps(_mm_load_ps(SFIm + 8), mI));
	_mm_store_ps(SFIm + 12, _mm_sub_ps(mR, _mm_load_ps(SFRe + 8)));
	_mm_store_ps(SFRe + 8, _mm_add_ps(_mm_load_ps(SFRe + 8), mR));
	_mm_store_ps(SFIm + 8, _mm_add_ps(_mm_load_ps(SFIm + 8), mI));
	mR = _mm_add_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 8));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 8));
	_mm_store_ps(SFRe + 8, _mm_sub_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 8)));
	_mm_store_ps(SFIm + 8, _mm_sub_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 8)));
	_mm_store_ps(SFRe + 0, mR);
	_mm_store_ps(SFIm + 0, mI);
	mR = _mm_add_ps(_mm_load_ps(SFRe + 4), _mm_load_ps(SFRe + 12));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 4), _mm_load_ps(SFIm + 12));
	_mm_store_ps(SFRe + 12, _mm_sub_ps(_mm_load_ps(SFRe + 4), _mm_load_ps(SFRe + 12)));
	_mm_store_ps(SFIm + 12, _mm_sub_ps(_mm_load_ps(SFIm + 4), _mm_load_ps(SFIm + 12)));
	_mm_store_ps(SFRe + 4, mR);
	_mm_store_ps(SFIm + 4, mI);
	mRF1 = _mm_set_ps(0.831492, 0.923896, 0.980794, 1.000000);
	mIF1 = _mm_set_ps(-0.555536, -0.382643, -0.195044, -0.000000);
	mRF2 = _mm_set_ps(-0.195069, 0.382712, 0.831492, 1.000000);
	mIF2 = _mm_set_ps(-0.980790, -0.923868, -0.555536, -0.000000);
	mR = _mm_load_ps(SFRe + 16);
	mI = _mm_load_ps(SFIm + 16);
	_mm_store_ps(SFRe + 16, _mm_sub_ps(_mm_mul_ps(mR, mRF1), _mm_mul_ps(mI, mIF1)));
	_mm_store_ps(SFIm + 16, _mm_add_ps(_mm_mul_ps(mR, mIF1), _mm_mul_ps(mI, mRF1)));
	mR = _mm_load_ps(SFRe + 24);
	mI = _mm_load_ps(SFIm + 24);
	_mm_store_ps(SFRe + 24, _mm_sub_ps(_mm_mul_ps(mR, mRF2), _mm_mul_ps(mI, mIF2)));
	_mm_store_ps(SFIm + 24, _mm_add_ps(_mm_mul_ps(mR, mIF2), _mm_mul_ps(mI, mRF2)));
	mR = _mm_load_ps(SFRe + 24);
	mI = _mm_load_ps(SFIm + 24);
	_mm_store_ps(SFRe + 24, _mm_sub_ps(_mm_load_ps(SFIm + 16), mI));
	_mm_store_ps(SFIm + 24, _mm_sub_ps(mR, _mm_load_ps(SFRe + 16)));
	_mm_store_ps(SFRe + 16, _mm_add_ps(_mm_load_ps(SFRe + 16), mR));
	_mm_store_ps(SFIm + 16, _mm_add_ps(_mm_load_ps(SFIm + 16), mI));
	mRF1 = _mm_set_ps(0.195118, 0.382712, 0.555599, 0.707133);
	mIF1 = _mm_set_ps(-0.980780, -0.923868, -0.831451, -0.707080);
	mRF2 = _mm_set_ps(-0.555599, -0.923896, -0.980785, -0.707098);
	mIF2 = _mm_set_ps(0.831451, 0.382643, -0.195093, -0.707116);
	mR = _mm_load_ps(SFRe + 20);
	mI = _mm_load_ps(SFIm + 20);
	_mm_store_ps(SFRe + 20, _mm_sub_ps(_mm_mul_ps(mR, mRF1), _mm_mul_ps(mI, mIF1)));
	_mm_store_ps(SFIm + 20, _mm_add_ps(_mm_mul_ps(mR, mIF1), _mm_mul_ps(mI, mRF1)));
	mR = _mm_load_ps(SFRe + 28);
	mI = _mm_load_ps(SFIm + 28);
	_mm_store_ps(SFRe + 28, _mm_sub_ps(_mm_mul_ps(mR, mRF2), _mm_mul_ps(mI, mIF2)));
	_mm_store_ps(SFIm + 28, _mm_add_ps(_mm_mul_ps(mR, mIF2), _mm_mul_ps(mI, mRF2)));
	mR = _mm_load_ps(SFRe + 28);
	mI = _mm_load_ps(SFIm + 28);
	_mm_store_ps(SFRe + 28, _mm_sub_ps(_mm_load_ps(SFIm + 20), mI));
	_mm_store_ps(SFIm + 28, _mm_sub_ps(mR, _mm_load_ps(SFRe + 20)));
	_mm_store_ps(SFRe + 20, _mm_add_ps(_mm_load_ps(SFRe + 20), mR));
	_mm_store_ps(SFIm + 20, _mm_add_ps(_mm_load_ps(SFIm + 20), mI));
	mR = _mm_add_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 16));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 16));
	_mm_store_ps(SFRe + 16, _mm_sub_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 16)));
	_mm_store_ps(SFIm + 16, _mm_sub_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 16)));
	_mm_store_ps(SFRe + 0, mR);
	_mm_store_ps(SFIm + 0, mI);
	mR = _mm_add_ps(_mm_load_ps(SFRe + 4), _mm_load_ps(SFRe + 20));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 4), _mm_load_ps(SFIm + 20));
	_mm_store_ps(SFRe + 20, _mm_sub_ps(_mm_load_ps(SFRe + 4), _mm_load_ps(SFRe + 20)));
	_mm_store_ps(SFIm + 20, _mm_sub_ps(_mm_load_ps(SFIm + 4), _mm_load_ps(SFIm + 20)));
	_mm_store_ps(SFRe + 4, mR);
	_mm_store_ps(SFIm + 4, mI);
	mR = _mm_add_ps(_mm_load_ps(SFRe + 8), _mm_load_ps(SFRe + 24));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 8), _mm_load_ps(SFIm + 24));
	_mm_store_ps(SFRe + 24, _mm_sub_ps(_mm_load_ps(SFRe + 8), _mm_load_ps(SFRe + 24)));
	_mm_store_ps(SFIm + 24, _mm_sub_ps(_mm_load_ps(SFIm + 8), _mm_load_ps(SFIm + 24)));
	_mm_store_ps(SFRe + 8, mR);
	_mm_store_ps(SFIm + 8, mI);
	mR = _mm_add_ps(_mm_load_ps(SFRe + 12), _mm_load_ps(SFRe + 28));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 12), _mm_load_ps(SFIm + 28));
	_mm_store_ps(SFRe + 28, _mm_sub_ps(_mm_load_ps(SFRe + 12), _mm_load_ps(SFRe + 28)));
	_mm_store_ps(SFIm + 28, _mm_sub_ps(_mm_load_ps(SFIm + 12), _mm_load_ps(SFIm + 28)));
	_mm_store_ps(SFRe + 12, mR);
	_mm_store_ps(SFIm + 12, mI);
}
#else
//AVX
void StaticFFT_5()
{
	float Re0, Re1, Re2, Re3;
	float Im0, Im1, Im2, Im3;
	float RA, IA;
	float RF1, IF1, RF2, IF2;
	float R, I;
	__m128 mRF1, mIF1, mRF2, mIF2;
	__m128 mR, mI;
	__m256 m256RF1, m256IF1, m256RF2, m256IF2;
	__m256 m256R, m256I;
	R = SFRe[30] + SFRe[31];
	I = SFIm[30] + SFIm[31];
	SFRe[31] = SFRe[30] - SFRe[31];
	SFIm[31] = SFIm[30] - SFIm[31];
	SFRe[30] = R;
	SFIm[30] = I;
	R = SFRe[28] + SFRe[29];
	I = SFIm[28] + SFIm[29];
	SFRe[29] = SFRe[28] - SFRe[29];
	SFIm[29] = SFIm[28] - SFIm[29];
	SFRe[28] = R;
	SFIm[28] = I;
	Re0 = SFRe[24]; Im0 = SFIm[24];
	Re1 = SFRe[25]; Im1 = SFIm[25];
	Re2 = SFRe[26]; Im2 = SFIm[26];
	Re3 = SFRe[27]; Im3 = SFIm[27];
	SFRe[24] = Re0 + Re1; SFIm[24] = Im0 + Im1;
	SFRe[25] = Re0 - Re1; SFIm[25] = Im0 - Im1;
	SFRe[26] = Re2 + Re3; SFIm[26] = Im2 + Im3;
	SFRe[27] = Im2 - Im3; SFIm[27] = Re3 - Re2;
	RA = SFRe[24] + SFRe[26];
	IA = SFIm[24] + SFIm[26];
	SFRe[26] = SFRe[24] - SFRe[26];
	SFIm[26] = SFIm[24] - SFIm[26];
	SFRe[24] = RA;
	SFIm[24] = IA;
	RA = SFRe[25] + SFRe[27];
	IA = SFIm[25] + SFIm[27];
	SFRe[27] = SFRe[25] - SFRe[27];
	SFIm[27] = SFIm[25] - SFIm[27];
	SFRe[25] = RA;
	SFIm[25] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[28];
	I = SFIm[28];
	SFRe[28] = R * RF1 - I * IF1;
	SFIm[28] = R * IF1 + I * RF1;
	R = SFRe[30];
	I = SFIm[30];
	SFRe[30] = R * RF2 - I * IF2;
	SFIm[30] = R * IF2 + I * RF2;
	R = SFRe[30];
	I = SFIm[30];
	SFRe[30] = SFIm[28] - I;
	SFIm[30] = R - SFRe[28];
	SFRe[28] += R;
	SFIm[28] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[29];
	I = SFIm[29];
	SFRe[29] = R * RF1 - I * IF1;
	SFIm[29] = R * IF1 + I * RF1;
	R = SFRe[31];
	I = SFIm[31];
	SFRe[31] = R * RF2 - I * IF2;
	SFIm[31] = R * IF2 + I * RF2;
	R = SFRe[31];
	I = SFIm[31];
	SFRe[31] = SFIm[29] - I;
	SFIm[31] = R - SFRe[29];
	SFRe[29] += R;
	SFIm[29] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 24), _mm_load_ps(SFRe + 28));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 24), _mm_load_ps(SFIm + 28));
	_mm_store_ps(SFRe + 28, _mm_sub_ps(_mm_load_ps(SFRe + 24), _mm_load_ps(SFRe + 28)));
	_mm_store_ps(SFIm + 28, _mm_sub_ps(_mm_load_ps(SFIm + 24), _mm_load_ps(SFIm + 28)));
	_mm_store_ps(SFRe + 24, mR);
	_mm_store_ps(SFIm + 24, mI);
	R = SFRe[22] + SFRe[23];
	I = SFIm[22] + SFIm[23];
	SFRe[23] = SFRe[22] - SFRe[23];
	SFIm[23] = SFIm[22] - SFIm[23];
	SFRe[22] = R;
	SFIm[22] = I;
	R = SFRe[20] + SFRe[21];
	I = SFIm[20] + SFIm[21];
	SFRe[21] = SFRe[20] - SFRe[21];
	SFIm[21] = SFIm[20] - SFIm[21];
	SFRe[20] = R;
	SFIm[20] = I;
	Re0 = SFRe[16]; Im0 = SFIm[16];
	Re1 = SFRe[17]; Im1 = SFIm[17];
	Re2 = SFRe[18]; Im2 = SFIm[18];
	Re3 = SFRe[19]; Im3 = SFIm[19];
	SFRe[16] = Re0 + Re1; SFIm[16] = Im0 + Im1;
	SFRe[17] = Re0 - Re1; SFIm[17] = Im0 - Im1;
	SFRe[18] = Re2 + Re3; SFIm[18] = Im2 + Im3;
	SFRe[19] = Im2 - Im3; SFIm[19] = Re3 - Re2;
	RA = SFRe[16] + SFRe[18];
	IA = SFIm[16] + SFIm[18];
	SFRe[18] = SFRe[16] - SFRe[18];
	SFIm[18] = SFIm[16] - SFIm[18];
	SFRe[16] = RA;
	SFIm[16] = IA;
	RA = SFRe[17] + SFRe[19];
	IA = SFIm[17] + SFIm[19];
	SFRe[19] = SFRe[17] - SFRe[19];
	SFIm[19] = SFIm[17] - SFIm[19];
	SFRe[17] = RA;
	SFIm[17] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[20];
	I = SFIm[20];
	SFRe[20] = R * RF1 - I * IF1;
	SFIm[20] = R * IF1 + I * RF1;
	R = SFRe[22];
	I = SFIm[22];
	SFRe[22] = R * RF2 - I * IF2;
	SFIm[22] = R * IF2 + I * RF2;
	R = SFRe[22];
	I = SFIm[22];
	SFRe[22] = SFIm[20] - I;
	SFIm[22] = R - SFRe[20];
	SFRe[20] += R;
	SFIm[20] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[21];
	I = SFIm[21];
	SFRe[21] = R * RF1 - I * IF1;
	SFIm[21] = R * IF1 + I * RF1;
	R = SFRe[23];
	I = SFIm[23];
	SFRe[23] = R * RF2 - I * IF2;
	SFIm[23] = R * IF2 + I * RF2;
	R = SFRe[23];
	I = SFIm[23];
	SFRe[23] = SFIm[21] - I;
	SFIm[23] = R - SFRe[21];
	SFRe[21] += R;
	SFIm[21] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 16), _mm_load_ps(SFRe + 20));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 16), _mm_load_ps(SFIm + 20));
	_mm_store_ps(SFRe + 20, _mm_sub_ps(_mm_load_ps(SFRe + 16), _mm_load_ps(SFRe + 20)));
	_mm_store_ps(SFIm + 20, _mm_sub_ps(_mm_load_ps(SFIm + 16), _mm_load_ps(SFIm + 20)));
	_mm_store_ps(SFRe + 16, mR);
	_mm_store_ps(SFIm + 16, mI);
	Re0 = SFRe[12]; Im0 = SFIm[12];
	Re1 = SFRe[13]; Im1 = SFIm[13];
	Re2 = SFRe[14]; Im2 = SFIm[14];
	Re3 = SFRe[15]; Im3 = SFIm[15];
	SFRe[12] = Re0 + Re1; SFIm[12] = Im0 + Im1;
	SFRe[13] = Re0 - Re1; SFIm[13] = Im0 - Im1;
	SFRe[14] = Re2 + Re3; SFIm[14] = Im2 + Im3;
	SFRe[15] = Im2 - Im3; SFIm[15] = Re3 - Re2;
	RA = SFRe[12] + SFRe[14];
	IA = SFIm[12] + SFIm[14];
	SFRe[14] = SFRe[12] - SFRe[14];
	SFIm[14] = SFIm[12] - SFIm[14];
	SFRe[12] = RA;
	SFIm[12] = IA;
	RA = SFRe[13] + SFRe[15];
	IA = SFIm[13] + SFIm[15];
	SFRe[15] = SFRe[13] - SFRe[15];
	SFIm[15] = SFIm[13] - SFIm[15];
	SFRe[13] = RA;
	SFIm[13] = IA;
	Re0 = SFRe[8]; Im0 = SFIm[8];
	Re1 = SFRe[9]; Im1 = SFIm[9];
	Re2 = SFRe[10]; Im2 = SFIm[10];
	Re3 = SFRe[11]; Im3 = SFIm[11];
	SFRe[8] = Re0 + Re1; SFIm[8] = Im0 + Im1;
	SFRe[9] = Re0 - Re1; SFIm[9] = Im0 - Im1;
	SFRe[10] = Re2 + Re3; SFIm[10] = Im2 + Im3;
	SFRe[11] = Im2 - Im3; SFIm[11] = Re3 - Re2;
	RA = SFRe[8] + SFRe[10];
	IA = SFIm[8] + SFIm[10];
	SFRe[10] = SFRe[8] - SFRe[10];
	SFIm[10] = SFIm[8] - SFIm[10];
	SFRe[8] = RA;
	SFIm[8] = IA;
	RA = SFRe[9] + SFRe[11];
	IA = SFIm[9] + SFIm[11];
	SFRe[11] = SFRe[9] - SFRe[11];
	SFIm[11] = SFIm[9] - SFIm[11];
	SFRe[9] = RA;
	SFIm[9] = IA;
	R = SFRe[6] + SFRe[7];
	I = SFIm[6] + SFIm[7];
	SFRe[7] = SFRe[6] - SFRe[7];
	SFIm[7] = SFIm[6] - SFIm[7];
	SFRe[6] = R;
	SFIm[6] = I;
	R = SFRe[4] + SFRe[5];
	I = SFIm[4] + SFIm[5];
	SFRe[5] = SFRe[4] - SFRe[5];
	SFIm[5] = SFIm[4] - SFIm[5];
	SFRe[4] = R;
	SFIm[4] = I;
	Re0 = SFRe[0]; Im0 = SFIm[0];
	Re1 = SFRe[1]; Im1 = SFIm[1];
	Re2 = SFRe[2]; Im2 = SFIm[2];
	Re3 = SFRe[3]; Im3 = SFIm[3];
	SFRe[0] = Re0 + Re1; SFIm[0] = Im0 + Im1;
	SFRe[1] = Re0 - Re1; SFIm[1] = Im0 - Im1;
	SFRe[2] = Re2 + Re3; SFIm[2] = Im2 + Im3;
	SFRe[3] = Im2 - Im3; SFIm[3] = Re3 - Re2;
	RA = SFRe[0] + SFRe[2];
	IA = SFIm[0] + SFIm[2];
	SFRe[2] = SFRe[0] - SFRe[2];
	SFIm[2] = SFIm[0] - SFIm[2];
	SFRe[0] = RA;
	SFIm[0] = IA;
	RA = SFRe[1] + SFRe[3];
	IA = SFIm[1] + SFIm[3];
	SFRe[3] = SFRe[1] - SFRe[3];
	SFIm[3] = SFIm[1] - SFIm[3];
	SFRe[1] = RA;
	SFIm[1] = IA;
	RF1 = 1.000000;
	IF1 = -0.000000;
	RF2 = 1.000000;
	IF2 = -0.000000;
	R = SFRe[4];
	I = SFIm[4];
	SFRe[4] = R * RF1 - I * IF1;
	SFIm[4] = R * IF1 + I * RF1;
	R = SFRe[6];
	I = SFIm[6];
	SFRe[6] = R * RF2 - I * IF2;
	SFIm[6] = R * IF2 + I * RF2;
	R = SFRe[6];
	I = SFIm[6];
	SFRe[6] = SFIm[4] - I;
	SFIm[6] = R - SFRe[4];
	SFRe[4] += R;
	SFIm[4] += I;
	RF1 = 0.707133;
	IF1 = -0.707080;
	RF2 = -0.707098;
	IF2 = -0.707116;
	R = SFRe[5];
	I = SFIm[5];
	SFRe[5] = R * RF1 - I * IF1;
	SFIm[5] = R * IF1 + I * RF1;
	R = SFRe[7];
	I = SFIm[7];
	SFRe[7] = R * RF2 - I * IF2;
	SFIm[7] = R * IF2 + I * RF2;
	R = SFRe[7];
	I = SFIm[7];
	SFRe[7] = SFIm[5] - I;
	SFIm[7] = R - SFRe[5];
	SFRe[5] += R;
	SFIm[5] += I;
	mR = _mm_add_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 4));
	mI = _mm_add_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 4));
	_mm_store_ps(SFRe + 4, _mm_sub_ps(_mm_load_ps(SFRe + 0), _mm_load_ps(SFRe + 4)));
	_mm_store_ps(SFIm + 4, _mm_sub_ps(_mm_load_ps(SFIm + 0), _mm_load_ps(SFIm + 4)));
	_mm_store_ps(SFRe + 0, mR);
	_mm_store_ps(SFIm + 0, mI);
	mRF1 = _mm_set_ps(0.382712, 0.707133, 0.923896, 1.000000);
	mIF1 = _mm_set_ps(-0.923868, -0.707080, -0.382643, -0.000000);
	mRF2 = _mm_set_ps(-0.923896, -0.707098, 0.382712, 1.000000);
	mIF2 = _mm_set_ps(0.382643, -0.707116, -0.923868, -0.000000);
	mR = _mm_load_ps(SFRe + 8);
	mI = _mm_load_ps(SFIm + 8);
	_mm_store_ps(SFRe + 8, _mm_sub_ps(_mm_mul_ps(mR, mRF1), _mm_mul_ps(mI, mIF1)));
	_mm_store_ps(SFIm + 8, _mm_add_ps(_mm_mul_ps(mR, mIF1), _mm_mul_ps(mI, mRF1)));
	mR = _mm_load_ps(SFRe + 12);
	mI = _mm_load_ps(SFIm + 12);
	_mm_store_ps(SFRe + 12, _mm_sub_ps(_mm_mul_ps(mR, mRF2), _mm_mul_ps(mI, mIF2)));
	_mm_store_ps(SFIm + 12, _mm_add_ps(_mm_mul_ps(mR, mIF2), _mm_mul_ps(mI, mRF2)));
	mR = _mm_load_ps(SFRe + 12);
	mI = _mm_load_ps(SFIm + 12);
	_mm_store_ps(SFRe + 12, _mm_sub_ps(_mm_load_ps(SFIm + 8), mI));
	_mm_store_ps(SFIm + 12, _mm_sub_ps(mR, _mm_load_ps(SFRe + 8)));
	_mm_store_ps(SFRe + 8, _mm_add_ps(_mm_load_ps(SFRe + 8), mR));
	_mm_store_ps(SFIm + 8, _mm_add_ps(_mm_load_ps(SFIm + 8), mI));
	m256R = _mm256_add_ps(_mm256_load_ps(SFRe + 0), _mm256_load_ps(SFRe + 8));
	m256I = _mm256_add_ps(_mm256_load_ps(SFIm + 0), _mm256_load_ps(SFIm + 8));
	_mm256_store_ps(SFRe + 8, _mm256_sub_ps(_mm256_load_ps(SFRe + 0), _mm256_load_ps(SFRe + 8)));
	_mm256_store_ps(SFIm + 8, _mm256_sub_ps(_mm256_load_ps(SFIm + 0), _mm256_load_ps(SFIm + 8)));
	_mm256_store_ps(SFRe + 0, m256R);
	_mm256_store_ps(SFIm + 0, m256I);
	m256RF1 = _mm256_set_ps(0.195118, 0.382712, 0.555599, 0.707133, 0.831492, 0.923896, 0.980794, 1.000000);
	m256IF1 = _mm256_set_ps(-0.980780, -0.923868, -0.831451, -0.707080, -0.555536, -0.382643, -0.195044, -0.000000);
	m256RF2 = _mm256_set_ps(-0.555599, -0.923896, -0.980785, -0.707098, -0.195069, 0.382712, 0.831492, 1.000000);
	m256IF2 = _mm256_set_ps(0.831451, 0.382643, -0.195093, -0.707116, -0.980790, -0.923868, -0.555536, -0.000000);
	m256R = _mm256_load_ps(SFRe + 16);
	m256I = _mm256_load_ps(SFIm + 16);
	_mm256_store_ps(SFRe + 16, _mm256_sub_ps(_mm256_mul_ps(m256R, m256RF1), _mm256_mul_ps(m256I, m256IF1)));
	_mm256_store_ps(SFIm + 16, _mm256_add_ps(_mm256_mul_ps(m256R, m256IF1), _mm256_mul_ps(m256I, m256RF1)));
	m256R = _mm256_load_ps(SFRe + 24);
	m256I = _mm256_load_ps(SFIm + 24);
	_mm256_store_ps(SFRe + 24, _mm256_sub_ps(_mm256_mul_ps(m256R, m256RF2), _mm256_mul_ps(m256I, m256IF2)));
	_mm256_store_ps(SFIm + 24, _mm256_add_ps(_mm256_mul_ps(m256R, m256IF2), _mm256_mul_ps(m256I, m256RF2)));
	m256R = _mm256_load_ps(SFRe + 24);
	m256I = _mm256_load_ps(SFIm + 24);
	_mm256_store_ps(SFRe + 24, _mm256_sub_ps(_mm256_load_ps(SFIm + 16), m256I));
	_mm256_store_ps(SFIm + 24, _mm256_sub_ps(m256R, _mm256_load_ps(SFRe + 16)));
	_mm256_store_ps(SFRe + 16, _mm256_add_ps(_mm256_load_ps(SFRe + 16), m256R));
	_mm256_store_ps(SFIm + 16, _mm256_add_ps(_mm256_load_ps(SFIm + 16), m256I));
	m256R = _mm256_add_ps(_mm256_load_ps(SFRe + 0), _mm256_load_ps(SFRe + 16));
	m256I = _mm256_add_ps(_mm256_load_ps(SFIm + 0), _mm256_load_ps(SFIm + 16));
	_mm256_store_ps(SFRe + 16, _mm256_sub_ps(_mm256_load_ps(SFRe + 0), _mm256_load_ps(SFRe + 16)));
	_mm256_store_ps(SFIm + 16, _mm256_sub_ps(_mm256_load_ps(SFIm + 0), _mm256_load_ps(SFIm + 16)));
	_mm256_store_ps(SFRe + 0, m256R);
	_mm256_store_ps(SFIm + 0, m256I);
	m256R = _mm256_add_ps(_mm256_load_ps(SFRe + 8), _mm256_load_ps(SFRe + 24));
	m256I = _mm256_add_ps(_mm256_load_ps(SFIm + 8), _mm256_load_ps(SFIm + 24));
	_mm256_store_ps(SFRe + 24, _mm256_sub_ps(_mm256_load_ps(SFRe + 8), _mm256_load_ps(SFRe + 24)));
	_mm256_store_ps(SFIm + 24, _mm256_sub_ps(_mm256_load_ps(SFIm + 8), _mm256_load_ps(SFIm + 24)));
	_mm256_store_ps(SFRe + 8, m256R);
	_mm256_store_ps(SFIm + 8, m256I);
}
#endif
